package com.linjuke.beginsum.web.modules.action;

import com.linjuke.beginsum.biz.ao.PhoneUserAO;
import com.linjuke.beginsum.web.common.BaseAction;
import com.zjuh.splist.core.annotation.DefaultTarget;
import com.zjuh.splist.web.RunData;
import com.zjuh.splist.web.TemplateContext;
import com.zjuh.sweet.result.Result;

public class PhoneUserAction extends BaseAction {
	
	private PhoneUserAO phoneUserAO;
	
	@DefaultTarget("json/success")
	public void doCallPhone(RunData rundata, TemplateContext templateContext) {
		String fromPhone = rundata.getQueryString().getString("fromPhone");
		String targetPhone = rundata.getQueryString().getString("targetPhone");
		long itemId = rundata.getQueryString().getLong("itemId");
		Result result = phoneUserAO.callPhone(fromPhone, targetPhone, itemId);
		if (!result.isSuccess()) {
			this.handleErrorJson(result, rundata, templateContext);
		}
	}

	public void setPhoneUserAO(PhoneUserAO phoneUserAO) {
		this.phoneUserAO = phoneUserAO;
	}

}
